package com.tms.order.mapper;

import java.util.List;
import com.tms.order.domain.Exception;
import org.apache.ibatis.annotations.Select;

/**
 * 异常统计Mapper接口
 *
 * @author ruoyi
 * @date 2024-10-29
 */
public interface ExceptionMapper
{
    /**
     * 查询异常统计
     *
     * @param id 异常统计主键
     * @return 异常统计
     */
    public Exception selectExceptionById(Long id);

    /**
     * 查询异常统计列表
     *
     * @param exception 异常统计
     * @return 异常统计集合
     */
    public List<Exception> selectExceptionList(Exception exception);

    /**
     * 新增异常统计
     *
     * @param exception 异常统计
     * @return 结果
     */
    public int insertException(Exception exception);

    /**
     * 修改异常统计
     *
     * @param exception 异常统计
     * @return 结果
     */
    public int updateException(Exception exception);

    /**
     * 删除异常统计
     *
     * @param id 异常统计主键
     * @return 结果
     */
    public int deleteExceptionById(Long id);

    /**
     * 批量删除异常统计
     *
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteExceptionByIds(Long[] ids);

//    @Select("SELECT \n" +
//            "    (SELECT COUNT(*) FROM tms_draw) AS num,\n" +
//            "    event_time as time,\n" +
//            "    COUNT(*) AS yc,\n" +
//            "    SUM(CASE WHEN processing_status = '已完成' THEN 1 ELSE 0 END) AS ywc,\n" +
//            "    SUM(CASE WHEN processing_status = '未处理' THEN 1 ELSE 0 END) AS wcl,\n" +
//            "    SUM(CASE WHEN processing_status = '处理中' THEN 1 ELSE 0 END) AS clz\n" +
//            "FROM \n" +
//            "    exmanagement\n" +
//            "GROUP BY \n" +
//            "    event_time")
    List<Exception> countException(Exception exception);
}
